﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.IO;
using System.ComponentModel;


namespace TimeReporter_II
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        TaskListST theTasks = TaskListST.GetInstance();
        ProjectList theProjects = ProjectList.getInstance();

        
        
        
        public MainWindow()
        {
            InitializeComponent();
            theProjects.PropertyChanged += new PropertyChangedEventHandler(theProjects_PropertyChanged);

           
           

        }

        void theProjects_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            Console.WriteLine("Project updated");
        }

        private void btnSelectFolder_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.FolderBrowserDialog ofd = new System.Windows.Forms.FolderBrowserDialog();
            System.Windows.Forms.DialogResult theResult = ofd.ShowDialog();
            if (theResult == System.Windows.Forms.DialogResult.OK)
            {
                theProjects.PathToFiles = ofd.SelectedPath;
                Console.WriteLine("Done");
            }
        }

        private void btnGetData_Click(object sender, RoutedEventArgs e)
        {
            folderReader.populateTaskList(theProjects);
        }
    }
}
